var mongoose = require("mongoose");

//积分任务完成 积分变动 信息表(completeTask)

var completeTaskSchema = new mongoose.Schema({
  taskid: { type: mongoose.SchemaTypes.ObjectId, ref: "task" }, //任务id
  userid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "user_login",
    required: true
  }, //用户id
  goodid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "commodity"
  }, //用户id
  inttype: { type: String, required: true }, //积分变动类型
  complete_time: { type: Date, default: new Date() }, //完成时间
  integral: { type: String, required: true }, //变动积分
  taskPoints: { type: String, required: true } //任务原有积分
});

module.exports = mongoose.model("completeTask", completeTaskSchema);
